package com.multicampus.minishop.view.user;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.multicampus.minishop.framework.Action;
import com.multicampus.minishop.services.user.UserService;
import com.multicampus.minishop.services.user.impl.UserServiceImpl;
import com.multicampus.minishop.user.vo.UserVO;


public class LoginAction extends Action{

	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		
		UserVO vo=new UserVO();
		vo.setUserId(request.getParameter("userId"));
		vo.setPassword(request.getParameter("password"));
		
		UserService service=new UserServiceImpl();
		UserVO dbVO=service.loginUser(vo);
		
		HttpSession session=request.getSession();
		session.setAttribute("user", dbVO);
		
		return "redirect:/index.jsp";

	}

}
